package cw.spring.security.acl.poc.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.validator.Length;

@Entity
@Table(name = "Book", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }), @UniqueConstraint(columnNames = { "id" }) })
public class BookModel {

  private long id;

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  public long getId() {
    return id;
  }

  public void setId(long id) {
    this.id = id;
  }

  private String name;

  @Length(min = 1, max = 256, message = "The book name must have a length superior or equals to 1")
  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

}
